import java.util.Scanner;
public class A29{
	public static void main(String[] args){
		String s1 = new String("abc");
		String s2 = "Abc";
		//==
		//基本数据类型:比的是数据值
		//引用数据类型:比的是地址值
		System.out.println(s1 == s2); //false
		//比较字符串对象中的内容是否相等
		boolean result1 = s1.equals(s2);
		System.out.println(result1);//false
		//比较字符串对象中的内容是否相等,忽略大小写
		boolean result2 = s1.equalsIgnoreCase(s2);
		System.out.println(result2);//true
		
		Scanner sc = new Scanner(System.in);
		System.out.println("请输入一个字符串");
		String str1 = sc.next();//abx是new 出来的
		String str2 = "abc";
		System.out.println(str1 == str2);//false
		
		//已知正确的用户名和密码，请用程序实现模拟用户登录
		//总共给三次机会，登录之后，给出相应的提示
		String rightUserName = "zcrlqq";
		String rightPassWord = "123456";
		for(int i = 0;i < 3;i++){
			System.out.println("请输入用户名");
			String userName = sc.next();
			System.out.println("请输入密码");
			String password = sc.next();
			if(userName.equals(rightUserName) && password.equals(rightPassWord)){
				System.out.println("用户登录成功");
				break;
			}else if(i == 2){
				System.out.println("次数已用完,账户已锁定");
				
			}else{
				System.out.println("用户名或密码输入错误,还有"+(2-i)+"次机会");
			}
			
		}
	}
}